package io.renren.controller;


import io.renren.annotation.Login;
import io.renren.annotation.LoginUser;
import io.renren.common.utils.R;
import io.renren.entity.StudentEntity;
import io.renren.service.QuestionService;
import io.renren.util.ApiBaseAction;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 题目模块
 *
 * @author huolikang
 */
@RestController
@RequestMapping("/api/question")
public class ApiQuestionController extends ApiBaseAction {

    @Autowired
    private QuestionService questionService;

    /**
     * 收藏题目
     * 在所有练习中把题目加到错题练习中收藏
     *
     * @param student    学员实体类
     * @param questionId 题目id
     * @return R
     */
    @Login
    @PostMapping("insertErrorQuestion")
    @ApiOperation("收藏题目")
    public R insertErrorQuestion(@LoginUser StudentEntity student, Integer questionId) {
        return questionService.insertErrorQuestion(student, questionId);
    }

}
